package com.zhanglehua.study.awt.graphics;

import java.awt.Color;
import java.awt.Graphics;

public class MyLine {
	
	private int orgX;
	private int orgY;
	private int endX;
	private int endY;

	public MyLine(int orgX, int orgY, int endX, int endY) {
		this.orgX = orgX;
		this.orgY = orgY;
		this.endX = endX;
		this.endY = endY;
	}

	public int getOrgX() {
		return orgX;
	}

	public int getOrgY() {
		return orgY;
	}

	public int getEndX() {
		return endX;
	}

	public int getEndY() {
		return endY;
	}

	public void drawMe(Graphics graphics) {
		graphics.setColor(Color.RED);
		
		graphics.drawString(new StringBuffer().append("(").append(orgX).append(
		",").append(orgY).append(")").toString(), orgX, orgY);
		
		graphics.drawString(new StringBuffer().append("(").append(endX).append(
				",").append(endX).append(")").toString(), endX, endY);
		
		graphics.drawLine(orgX, orgY, endX, endY);
	}
}